package com.cat.recruit.common.constant;

import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 定义考核类型常量
 */
public class AccessType {
    // 一面
    public static final String FIRST_INTERVIEW = "初面";
    // 一轮考核
    public static final String FIRST_ROUND_AUDIT = "一轮考核";
    // 二轮考核
    public static final String SECOND_ROUND_AUDIT = "二轮考核";

    public static final List<String> ACCESS_TYPE_LIST = List.of(
            FIRST_INTERVIEW,
            FIRST_ROUND_AUDIT,
            SECOND_ROUND_AUDIT
    );

    private static final Set<String> ACCESS_TYPE_SET = new HashSet<>(ACCESS_TYPE_LIST);

    public static boolean contains(String accessType) {
        return ACCESS_TYPE_SET.contains(accessType);
    }

    private static final Map<String, String> STATE_MAPPING = new HashMap<>();
    static {
        STATE_MAPPING.put("初面", "已报名");
        STATE_MAPPING.put("一面", "一轮考核中");
        STATE_MAPPING.put("二面", "一轮已通过");
        // 后续要新增状态直接在这里加
    }

    public String convertState(String state) {
        return STATE_MAPPING.getOrDefault(state, state); // 不在映射里的保持原值
    }

}
